- @title = t('groups.heading')

- if (@unapproved_groups.any? or params[:pending_approval]) and @logged_in.admin?(:manage_groups)
  .callout.callout-warning
    = t('groups.pending_approval.description', count: @unapproved_groups.length)
    - if @unapproved_groups.any?
      %ul
        - @unapproved_groups.each do |group|
          %li= link_to group.name, group
    - else
      %p= t('none')

.row
  .col-md-4
    .box.box-info{style: 'margin-top: 25px'}
      .box-header
        %h3.box-title= t('groups.search.heading')
      .box-body
        = form_tag(groups_path, method: 'get', class: 'form-inline group-search-form') do
          .form-group
            = text_field_tag :name, params[:name], class: 'form-control', placeholder: t('groups.search.name_placeholder')
          .form-group
            = button_tag class: 'btn btn-info' do
              = icon 'fa fa-search'
              = t('groups.search.submit')

    .box.box-info
      .box-header
        %h3.box-title= t('groups.browse.heading')
      .box-body
        .form-group
          .group-category-lookup
            = select_tag 'category', options_for_select([[t('groups.browse.select_category'), '']] + @categories), class: 'form-control'
        .form-group
          = link_to groups_path(name: '') do
            = icon 'fa fa-group'
            = t('groups.browse.all')

    .box.box-success
      .box-header
        %h3.box-title= t('groups.create.heading')
      .box-body
        %p
          = t('groups.create.description')
        %p
          = link_to new_group_path, class: 'btn btn-success' do
            = icon 'fa fa-plus-circle'
            = t('groups.create.button')

  .col-md-8
    - if new_groups.any?
      %h3= t('groups.new_list.heading')
      %table.table.group-list
        %tr
          %th
          %th= t('groups.table.group_name')
          %th= t('groups.table.member_count')
        - new_groups.each do |group|
          %tr.row-with-avatar
            %td.avatar
              = group_avatar_tag(group)
            %td.name
              = link_to group.name, group
              %small.badge.bg-green= t('new')
              - if group.private?
                %span.label.label-warning
                  = icon 'fa fa-lock'
                  = t('groups.private.label')
              - if group.hidden?
                %span.label.label-danger
                  = icon 'fa fa-eye-slash'
                  = t('groups.hidden.label')
            %td
              = group.memberships.count

    %h3= t('groups.your_groups')
    = render partial: 'person_groups'
